home *** CD-ROM | disk | FTP | other *** search
/ Programming in Microsoft Windows with C# / Programacion en Microsoft Windows con C#.iso / Codigo / Páginas y transformaciones / ArbitraryCoordinates / ArbitraryCoordinates.cs next >
Encoding:
Text File  |  2002-05-06  |  935 b   |  30 lines

  1. // --------------------------------------------------
  2. // ArbitraryCoordinates.cs ⌐ 2001 by Charles Petzold
  3. // --------------------------------------------------
  4. using System;
  5. using System.Drawing;
  6. using System.Windows.Forms;
  7.  
  8. class ArbitraryCoordinates: PrintableForm
  9. {
  10.      public new static void Main()
  11.      {
  12.           Application.Run(new ArbitraryCoordinates());
  13.      }
  14.      public ArbitraryCoordinates()
  15.      {
  16.           Text = "Coordenadas arbitrarias";
  17.      }
  18.      protected override void DoPage(Graphics grfx, Color clr, int cx, int cy)
  19.      {
  20.           grfx.PageUnit = GraphicsUnit.Pixel;
  21.           SizeF sizef = grfx.VisibleClipBounds.Size;
  22.  
  23.           grfx.PageUnit  = GraphicsUnit.Inch;
  24.           grfx.PageScale = Math.Min(sizef.Width  / grfx.DpiX / 1000, 
  25.                                     sizef.Height / grfx.DpiY / 1000);
  26.  
  27.           grfx.DrawEllipse(new Pen(clr), 0, 0, 990, 990);
  28.      }
  29. }
  30.